﻿namespace HiMap.Driver.Ogr
{
    using HiMap.Carto;
    using HiMap.Driver;
    using System;
    using System.Text;

    public class OgrDataFactory : IDataFactory
    {
        private string _Path;

        public OgrDataFactory(string Path)
        {
            this._Path = Path;
            if (this._Path.Substring(0, 1) != @"\")
            {
                this._Path = @"\" + this._Path;
            }
            if (this._Path.Substring(this._Path.Length - 1, 1) != @"\")
            {
                this._Path = this._Path + @"\";
            }
        }

        public static bool CopyTo(IFeatureClass fClass, string FileNameNoExt)
        {
            return false;
        }

        public static string GetExt()
        {
            return "dxf";
        }

        IClass IDataFactory.Open(string Name, bool edit)
        {
            return new OgrFeatureClassClass(VC.KWG_OGRLAYER_OPEN(new StringBuilder(this._Path + Name), edit), false);
        }
    }
}

